#ifndef _BSP_USART_H
#define _BSP_USART_H

#pragma once

#ifdef __cplusplus
extern "C" {
#endif

/* Includes ----------------------------------------------------------------- */
#include <dma.h>
#include <stdbool.h>
#include <usart.h>
/* Exported constants ------------------------------------------------------- */
extern DMA_HandleTypeDef hdma_usart2_tx;
extern DMA_HandleTypeDef hdma_usart2_rx;
/* Exported macro ----------------------------------------------------------- */
/* Exported types ----------------------------------------------------------- */
typedef struct {
  volatile bool rx_flag;
  volatile uint8_t rx_len;
  UART_HandleTypeDef *huart;
} UartRx_t;
/* Exported functions prototypes -------------------------------------------- */
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart);
void Uart_Init(UartRx_t *uart, UART_HandleTypeDef *huart);
void Bsp_UartSendData(UartRx_t *uart, uint8_t *tx_buff, uint8_t len);
void Bsp_UartRecData(UartRx_t *uart, uint8_t *rx_buff, uint8_t len);

#ifdef __cplusplus
}
#endif
#endif
